package com.stormrage.edu.dao.exam.impl;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import com.stormrage.edu.dao.exam.ExmScoreDao;
import com.stormrage.entity.exam.ExmScore;
import com.stormragetech.core.dao.MysBaseDao;
import com.stormragetech.core.exception.StormrageTechException;

/**
 * @Title: EduChapterDaoImpl.java
 * @Package com.stormrage.edu.dao.edu.impl
 * @Description: 成绩 Dao
 * @author www.stormragetech.com
 * @date 2016年4月8日
 * @version V1.0
 */
@Repository
public class ExmScoreDaoImpl extends MysBaseDao implements ExmScoreDao {

	private static final Logger logger = LoggerFactory.getLogger(ExmScoreDaoImpl.class);

	@Override
	public void update(final ExmScore arg0) throws StormrageTechException {

		logger.debug(" 【 Dao 】-【 ExmScoreDao 】-【 update 】- 开始运行 ");

		final String query = "UPDATE exm_score SET exam = :exam WHERE id = :id";
		logger.debug(" 数据库执行语句为 " + query);

		update(query, arg0);

		logger.debug(" 【 Dao 】-【 ExmScoreDao 】-【 update 】- 完成运行 ");

	}

	@Override
	public ExmScore queryByStuId(final Map<String, Object> map) throws StormrageTechException {

		logger.debug(" 【 Dao 】-【 ExmScoreDao 】-【 QueryByStuId 】- 开始运行 ");

		final String query = "SELECT * FROM exm_score WHERE stu_id = :stuId";
		logger.debug(" 数据库执行语句为 " + query);

		ExmScore entity = queryObject(query, ExmScore.class, map);

		logger.debug(" 【 Dao 】-【 ExmScoreDao 】-【 QueryByStuId 】- 完成运行 ");
		return entity;

	}

}
